/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GameSettingPanel.java
 *
 * Created on 2009-9-24, 23:32:58
 */
package com.res0w.SMMS.ui.admin;

import com.res0w.SMMS.admin.Setting;
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;

/**
 *
 * @author res0w
 * @since 2009-9-24
 * @version 0.3
 */
public class GameSettingPanel extends javax.swing.JPanel {

    /** Creates new form GameSettingPanel */
    public GameSettingPanel() {
        initComponents();
        readData();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        hostName = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        hostSeason = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        bYear = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        bMonth = new javax.swing.JTextField();
        bDay = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        eYear = new javax.swing.JTextField();
        eMonth = new javax.swing.JTextField();
        eDay = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        alterItemsTable = new javax.swing.JTable();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        peopleCount = new javax.swing.JTextField();
        maxScore = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        minScore = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        bScRecord = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        qCount = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        relayTable = new javax.swing.JTable();
        btnSubmit = new javax.swing.JButton();
        hostYear = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        qComboBox = new javax.swing.JComboBox();
        jLabel23 = new javax.swing.JLabel();
        limitPerPerson = new javax.swing.JTextField();

        setBackground(new java.awt.Color(255, 255, 255));
        setFont(new java.awt.Font("微软雅黑", 0, 12));
        setPreferredSize(new java.awt.Dimension(950, 530));

        jLabel1.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel1.setText("举办单位：");

        hostName.setFont(new java.awt.Font("微软雅黑", 0, 12));
        hostName.setText("河北经贸大学");

        jLabel2.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel2.setText("年度：");

        jLabel3.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel3.setText("年");

        jLabel4.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel4.setText("季运动会");

        hostSeason.setFont(new java.awt.Font("微软雅黑", 0, 12));

        jLabel5.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel5.setText("时间：");

        bYear.setFont(new java.awt.Font("微软雅黑", 0, 12));
        bYear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bYearActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel6.setText("年");

        jLabel7.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel7.setText("月");

        bMonth.setFont(new java.awt.Font("微软雅黑", 0, 12));

        bDay.setFont(new java.awt.Font("微软雅黑", 0, 12));

        jLabel8.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel8.setText("日");

        jLabel9.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel9.setText("到");

        eYear.setFont(new java.awt.Font("微软雅黑", 0, 12));
        eYear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eYearActionPerformed(evt);
            }
        });

        eMonth.setFont(new java.awt.Font("微软雅黑", 0, 12));
        eMonth.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eMonthActionPerformed(evt);
            }
        });

        eDay.setFont(new java.awt.Font("微软雅黑", 0, 12));

        jLabel10.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel10.setText("月");

        jLabel11.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel11.setText("年");

        jLabel12.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel12.setText("日");

        jLabel13.setFont(new java.awt.Font("微软雅黑", 0, 12));
        jLabel13.setText("项目类型设置：");

        alterItemsTable.setFont(new java.awt.Font("微软雅黑", 0, 12));
        alterItemsTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][]{
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},
                {"", "", "", "", ""},},
            new String[]{
                "项目名称", "项目类型", "最优选择", "性别区分", "是否复赛"
            }));
            alterItemsTable.setColumnSelectionAllowed(true);
            jScrollPane1.setViewportView(alterItemsTable);
            alterItemsTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
            alterItemsTable.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(tAlter2C));
            alterItemsTable.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(tAlter3C));
            alterItemsTable.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(tAlter4C));
            alterItemsTable.getColumnModel().getColumn(4).setCellEditor(new DefaultCellEditor(tAlter5C));

            jLabel14.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel14.setText("接力目类型设置：");

            jLabel15.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel15.setText("计分设置：");

            jLabel16.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel16.setText("得分人数：");

            peopleCount.setFont(new java.awt.Font("微软雅黑", 0, 12));

            maxScore.setFont(new java.awt.Font("微软雅黑", 0, 12));

            jLabel17.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel17.setText("最高分：");

            minScore.setFont(new java.awt.Font("微软雅黑", 0, 12));

            jLabel18.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel18.setText("最低分：");

            bScRecord.setFont(new java.awt.Font("微软雅黑", 0, 12));

            jLabel19.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel19.setText("破纪录加分：");

            jLabel20.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel20.setText("复赛设置：");

            qCount.setFont(new java.awt.Font("微软雅黑", 0, 12));
            qCount.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    qCountActionPerformed(evt);
                }
            });

            jLabel21.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel21.setText("前");

            jLabel22.setFont(new java.awt.Font("微软雅黑", 0, 12));
            jLabel22.setText("名进入复赛");

            relayTable.setFont(new java.awt.Font("微软雅黑", 0, 12));
            relayTable.setModel(new javax.swing.table.DefaultTableModel(
                new Object[][]{
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},
                    {"", "", "", ""},},
                new String[]{
                    "名称", "每队参与人数", "性别区分", "是否复赛"
                }));
                jScrollPane3.setViewportView(relayTable);
                relayTable.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(tAlter4C));
                relayTable.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(tAlter5C));

                btnSubmit.setFont(new java.awt.Font("微软雅黑", 0, 12));
                btnSubmit.setText("提交");
                btnSubmit.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        btnSubmitActionPerformed(evt);
                    }
                });

                hostYear.setFont(new java.awt.Font("微软雅黑", 0, 12));
                hostYear.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        hostYearActionPerformed(evt);
                    }
                });

                jButton2.setText("全部重写");

                qComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "每组", "全局" }));

                jLabel23.setFont(new java.awt.Font("微软雅黑", 0, 12));
                jLabel23.setText("每人限报项数：");

                javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
                this.setLayout(layout);
                layout.setHorizontalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(33, 33, 33)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 426, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(23, 23, 23)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel5))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(hostYear)
                                    .addComponent(bYear, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(bMonth, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel7)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(bDay, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel9)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(eYear, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel11)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(eMonth, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel10)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(eDay, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel12))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel3)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(hostSeason, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel4))))
                            .addComponent(jLabel13)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(hostName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(13, 13, 13)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(45, 45, 45)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel15)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(27, 27, 27)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jLabel17)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(maxScore, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jLabel16)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(peopleCount, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jLabel18)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(minScore, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jLabel19)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(bScRecord, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                                .addGap(37, 37, 37)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel23)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(limitPerPerson, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(qComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel21)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(qCount, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel22))
                                    .addComponent(jLabel20)))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel14)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(jButton2)
                                            .addGap(82, 82, 82)
                                            .addComponent(btnSubmit))
                                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 393, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addContainerGap(36, Short.MAX_VALUE))
                );
                layout.setVerticalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel1)
                                    .addComponent(hostName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel2)
                                    .addComponent(hostYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel3)
                                    .addComponent(hostSeason, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel4))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(bYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel6)
                                    .addComponent(bMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel7)
                                    .addComponent(bDay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel8)
                                    .addComponent(jLabel9)
                                    .addComponent(eYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel11)
                                    .addComponent(eMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel10)
                                    .addComponent(eDay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel12)
                                    .addComponent(jLabel5))
                                .addGap(30, 30, 30)
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel15)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel16)
                                            .addComponent(peopleCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel17)
                                            .addComponent(maxScore, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel18)
                                            .addComponent(minScore, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(bScRecord, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel19))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel14)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(qCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel22)
                                            .addComponent(jLabel21))
                                        .addGap(10, 10, 10)
                                        .addComponent(qComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel23)
                                            .addComponent(limitPerPerson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(44, 44, 44)))
                                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(btnSubmit)
                                    .addComponent(jButton2))))
                        .addContainerGap(32, Short.MAX_VALUE))
                );
            }// </editor-fold>//GEN-END:initComponents

    private void btnSubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSubmitActionPerformed
        // TODO add your handling code here:
        submitData();
}//GEN-LAST:event_btnSubmitActionPerformed

    private void hostYearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hostYearActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_hostYearActionPerformed

    private void bYearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bYearActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_bYearActionPerformed

    private void eYearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eYearActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_eYearActionPerformed

    private void eMonthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eMonthActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_eMonthActionPerformed

    private void qCountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_qCountActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_qCountActionPerformed

//Create by Author:
    private Object[] tAlter2CItems = {
        "计时",
        "距离",};
    private JComboBox tAlter2C = new JComboBox(tAlter2CItems);
    private Object[] tAlter3CItems = {
        "越小越优",
        "越大越优",};
    private JComboBox tAlter3C = new JComboBox(tAlter3CItems);
    private Object[] tAlter4CItems = {
        "区分",
        "不区分",};
    private JComboBox tAlter4C = new JComboBox(tAlter4CItems);
    private Object[] tAlter5CItems = {
        "是",
        "否",};
    private JComboBox tAlter5C = new JComboBox(tAlter5CItems);

    private void submitData() {
        Setting data = new Setting();
        data.hostName = hostName.getText().trim();
        data.hostYear = Integer.parseInt(hostYear.getText().trim());
        data.hostSeason = hostSeason.getText().trim();
        data.bYear = Integer.parseInt(bYear.getText().trim());
        data.bMonth = Integer.parseInt(bMonth.getText().trim());
        data.bDay = Integer.parseInt(bDay.getText().trim());
        data.eYear = Integer.parseInt(eYear.getText().trim());
        data.eMonth = Integer.parseInt(eMonth.getText().trim());
        data.eDay = Integer.parseInt(eDay.getText().trim());
        data.peopleCount = Integer.parseInt(peopleCount.getText().trim());
        data.maxScore = Integer.parseInt(maxScore.getText().trim());
        data.minScore = Integer.parseInt(minScore.getText().trim());
        data.bScRecord = Integer.parseInt(bScRecord.getText().trim());
        data.limitPerPerson = Integer.parseInt(limitPerPerson.getText().trim());

        if (qComboBox.getSelectedIndex() == 0) {
            //全局
            data.allPeopleCount = Integer.parseInt(qCount.getText().toString().trim());
            data.teamPeopleCount = -1;
        } else if (qComboBox.getSelectedIndex() == 1) {
            data.teamPeopleCount = Integer.parseInt(qCount.getText().toString().trim());
            data.allPeopleCount = -1;
        }

        int i = 0;
        while (alterItemsTable.getValueAt(i, 0).toString() != "") {
//            if (alterItemsTable.getValueAt(i, 0).toString()!=null) {
            //项目名称：
            data.alterItemsName =
                    alterItemsTable.getValueAt(i, 0).toString().trim();
            //项目类型：
            data.alterItemsType =
                    alterItemsTable.getValueAt(i, 1).toString().trim();
            //最优选择：
            if (alterItemsTable.getValueAt(i, 2).toString().trim().equals("越小越优")) {
                data.alterBestChoice = 0;
            } else if (alterItemsTable.getValueAt(i, 2).toString().trim().equals("越大越优")) {
                data.alterBestChoice = 1;
            }
            //性别区分
            if (alterItemsTable.getValueAt(i, 3).toString().trim().equals("区分")) {
                data.alterSex = 0;
            } else if (alterItemsTable.getValueAt(i, 3).toString().trim().equals("不区分")) {
                data.alterSex = 1;
            }
            //是否复赛
            if (alterItemsTable.getValueAt(i, 4).toString().trim().equals("是")) {
                data.alterQFinial = 0;
            } else if (alterItemsTable.getValueAt(i, 4).toString().trim().equals("否")) {
                data.alterQFinial = 1;
            }
            //增加进list
            data.alterSettingWrite();
            i++;
//            }
        }
        i=0;
        while (relayTable.getValueAt(i, 0).toString() != "") {
//            if (alterItemsTable.getValueAt(i, 0).toString()!=null) {
            //项目名称：
            data.relayItemsName =
                    relayTable.getValueAt(i, 0).toString().trim();
            //每队参与人数：
            data.relayTeamPeopleCount =
                    Integer.parseInt(relayTable.getValueAt(i, 1).toString());
            //性别区分
            if (relayTable.getValueAt(i, 2).toString().trim().equals("区分")) {
                data.relaySex = 0;
            } else if (relayTable.getValueAt(i, 2).toString().trim().equals("不区分")) {
                data.relaySex = 1;
            }
            //是否复赛
            if (relayTable.getValueAt(i, 3).toString().trim().equals("是")) {
                data.relayQFinal = 0;
            } else if (relayTable.getValueAt(i, 3).toString().trim().equals("否")) {
                data.relayQFinal = 1;
            }
            //增加进list
            data.relaySettingWrite();
            i++;
//            }
        }
        data.SettingPropertyUpdate(true);
    }

    private void readData() {
        Setting data = new Setting();
        data.SettingPropertyRead();

        hostName.setText(data.hostName);
        hostYear.setText(String.valueOf(data.hostYear));
        hostSeason.setText(data.hostSeason);
        bYear.setText(String.valueOf(data.bYear));
        bMonth.setText(String.valueOf(data.bMonth));
        bDay.setText(String.valueOf(data.bDay));
        eYear.setText(String.valueOf(data.eYear));
        eMonth.setText(String.valueOf(data.eMonth));
        eDay.setText(String.valueOf(data.eDay));
        maxScore.setText(String.valueOf(data.maxScore));
        minScore.setText(String.valueOf(data.minScore));
        peopleCount.setText(String.valueOf(data.peopleCount));
        bScRecord.setText(String.valueOf(data.bScRecord));
        limitPerPerson.setText(String.valueOf(data.limitPerPerson));

        if (data.allPeopleCount == -1) {
            //小组
            qComboBox.setSelectedIndex(1);
            qCount.setText(String.valueOf(data.teamPeopleCount));
        } else if (data.teamPeopleCount == -1) {
            //全局
            qComboBox.setSelectedIndex(0);
            qCount.setText(String.valueOf(data.allPeopleCount));
        }

        //ALTER
        for (int i = 0; i < data.alterReadList.size(); i = i + 6) {
            int editRow = i / 6;
            alterItemsTable.setValueAt(data.alterReadList.get(i), editRow, 0);
            alterItemsTable.setValueAt(data.alterReadList.get(i+1), editRow, 1);
            if (Integer.parseInt(data.alterReadList.get(i + 2).toString()) == 0) {
                alterItemsTable.setValueAt("越小越优", editRow, 2);
            } else if (Integer.parseInt(data.alterReadList.get(i + 2).toString()) == 1) {
                alterItemsTable.setValueAt("越大越优", editRow, 2);
            }

            if (Integer.parseInt(data.alterReadList.get(i + 3).toString()) == 0) {
                alterItemsTable.setValueAt("区分", editRow, 3);
            } else if (Integer.parseInt(data.alterReadList.get(i + 3).toString()) == 1) {
                alterItemsTable.setValueAt("不区分", editRow, 3);
            }

            if (Integer.parseInt(data.alterReadList.get(i + 4).toString()) == 0) {
                alterItemsTable.setValueAt("是", editRow, 4);
            } else if (Integer.parseInt(data.alterReadList.get(i + 4).toString()) == 1) {
                alterItemsTable.setValueAt("否", editRow, 4);
            }
        }
        //RELAY
         for (int i = 0; i < data.relayReadList.size(); i = i + 5) {
            int editRow = i / 5;
            relayTable.setValueAt(data.relayReadList.get(i), editRow, 0);
            relayTable.setValueAt(data.relayReadList.get(i+1), editRow, 1);
            if (Integer.parseInt(data.relayReadList.get(i + 2).toString()) == 0) {
                relayTable.setValueAt("区分", editRow, 2);
            } else if (Integer.parseInt(data.relayReadList.get(i + 2).toString()) == 1) {
                relayTable.setValueAt("不区分", editRow, 2);
            }
            if (Integer.parseInt(data.relayReadList.get(i + 3).toString()) == 0) {
                relayTable.setValueAt("是", editRow, 3);
            } else if (Integer.parseInt(data.relayReadList.get(i + 3).toString()) == 1) {
                relayTable.setValueAt("否", editRow, 3);
            }
        }


    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable alterItemsTable;
    private javax.swing.JTextField bDay;
    private javax.swing.JTextField bMonth;
    private javax.swing.JTextField bScRecord;
    private javax.swing.JTextField bYear;
    private javax.swing.JButton btnSubmit;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JTextField eDay;
    private javax.swing.JTextField eMonth;
    private javax.swing.JTextField eYear;
    private javax.swing.JTextField hostName;
    private javax.swing.JTextField hostSeason;
    private javax.swing.JTextField hostYear;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextField limitPerPerson;
    private javax.swing.JTextField maxScore;
    private javax.swing.JTextField minScore;
    private javax.swing.JTextField peopleCount;
    private javax.swing.JComboBox qComboBox;
    private javax.swing.JTextField qCount;
    private javax.swing.JTable relayTable;
    // End of variables declaration//GEN-END:variables
}
